# Copyright (C) 2013-2015 Ragpicker Developers.
# This file is part of Ragpicker Malware Crawler - http://code.google.com/p/malware-crawler/

import logging

from core.abstracts import Crawler


try:
    from yapsy.IPlugin import IPlugin
except ImportError:
    raise ImportError, 'Yapsy (Yet Another Plugin System) is required to run this program : http://yapsy.sourceforge.net'

log = logging.getLogger("MalwareblCrawler")

class Malwarebl(IPlugin, Crawler):
          
    def run(self):
        self.mapURL = {}
        log.debug("Fetching from Malware Black List")
        
        # parser
        soup = self.parse('http://www.malwareblacklist.com/mbl.xml')
        
        for row in soup('description'):
            site = str(row).split()[1].replace(',', '')
            self.storeURL(site)   
            
        log.info("Found %s urls" % len(self.mapURL))
                   
        return self.mapURL
